<template>
  <div>
    <el-divider>项目基本信息</el-divider>
    <el-form-item>
      <el-row type="flex" :gutter="20" align="middle">
        <el-col :span="6">
          <el-form-item label="报告类型" label-width="100px" prop="reportType">
            <el-select v-model="reportCommonObj.reportType" style="width: 100%" disabled>
              <el-option v-for="item in propertyType" :key="item.id" :value="item.id" :label="item.reportType" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="报告名称" label-width="100px" prop="reportName">
            <el-input v-model="reportCommonObj.reportName" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="报告文号" prop="reportId">
            <el-input v-model="reportCommonObj.reportId" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="项目类型" prop="projectType">
            <el-select v-model="reportCommonObj.projectType" style="width: 100%" :disabled="true">
              <el-option v-for="item in propertyProjectType" :key="item.id" :value="item.id" :label="item.projectTypeName" />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" :gutter="20" align="middle">
        <el-col :span="6">
          <el-form-item label="评估目的" prop="purpose">
            <el-select v-model="reportCommonObj.purpose" style="width: 100%">
              <el-option v-for="item in assessmentPurpose" :key="item.id" :value="item.id" :label="item.assessmentPurposeName" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="评估方法" prop="assessmentMethod">
            <el-select v-model="reportCommonObj.assessmentMethod" style="width: 100%">
              <el-option v-for="item in assessmentMethod" :key="item.id" :value="item.id" :label="item.assessmentMethodName" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="评估范围" label-width="100px" prop="scope">
            <el-select v-model="reportCommonObj.scope" style="width: 100%">
              <el-option v-for="item in scopeAssessment2" :key="item.id" :value="item.id" :label="item.scopeAssessmentName2" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="评估对象" label-width="100px" prop="evaluationObject">
            <el-select v-model="reportCommonObj.evaluationObject" style="width: 100%">
              <el-option v-for="item in evaluationObject" :key="item.id" :value="item.id" :label="item.evaluationObjectName" />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" :gutter="20" align="middle">
        <el-col :span="6">
          <el-form-item label="合同号" label-width="100px" prop="contract">
            <el-input v-model="reportCommonObj.contract" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="价值类型" label-width="100px" prop="valueType">
            <el-select v-model="reportCommonObj.valueType" style="width: 100%">
              <el-option v-for="item in valueType" :key="item.id" :value="item.id" :label="item.valueName" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="评估价值" label-width="100px" prop="assessValue">
            <el-input v-model="reportCommonObj.assessValue">
              <template slot="append">万元</template>
            </el-input>
          </el-form-item>
        </el-col>
        <!--        <el-col :span="6">-->
        <!--          <el-form-item label="标准收费" prop="chargeGist">-->
        <!--            <el-input v-model="reportCommonObj.standardValue">-->
        <!--              <el-select slot="prepend" v-model="reportCommonObj.chargeGist" placeholder="请选择" style="width: 90px" @change="calculatePayHandler">-->
        <!--                <el-option label="房地产" value="fdc" />-->
        <!--                <el-option label="土地" value="td" />-->
        <!--                <el-option label="资产" value="zc" />-->
        <!--                &lt;!&ndash;                <el-option label="租金" value="zj" />&ndash;&gt;-->
        <!--              </el-select>-->
        <!--              <template slot="append">-->
        <!--                元-->
        <!--              </template>-->
        <!--            </el-input>-->
        <!--          </el-form-item>-->
        <!--        </el-col>-->
        <el-col :span="6">
          <el-form-item label="标准收费" label-width="100px" prop="chargeGist">
            <el-input v-model="reportCommonObj.standardValue">
              <template slot="append">元</template>
            </el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" :gutter="20" align="middle">
        <el-col :span="6">
          <el-form-item label="评估基准日" prop="valuationDate">
            <el-date-picker
              v-model="reportCommonObj.valuationDate"
              value-format="timestamp"
              style="width: 100%"
              type="date"
              placeholder="选择日期"
              @change="reportProvideTimeChangeHandler"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="评估报告日" prop="provideDate">
            <el-date-picker
              v-model="reportCommonObj.provideDate"
              value-format="timestamp"
              style="width: 100%"
              type="date"
              placeholder="选择日期"
              @change="reportProvideTimeChangeHandler"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="发稿日期" prop="distributeNewsDispatchesDate">
            <el-date-picker
              v-model="reportCommonObj.distributeNewsDispatchesDate"
              value-format="timestamp"
              style="width: 100%"
              type="date"
              placeholder="选择日期"
              @change="reportProvideTimeChangeHandler"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="协议金额" label-width="100px" prop="agreementMoney">
            <el-input v-model="reportCommonObj.agreementMoney">
              <template slot="append">元</template>
            </el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" :gutter="20" align="middle">
        <el-col :span="6">
          <el-form-item label="技术员" prop="technician">
            <el-select v-model="reportCommonObj.technician" style="width: 100%" clearable filterable>
              <el-option v-for="item in noPageReportUserList" :key="item.id" :value="item.id" :label="item.nickName" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="签字估价师1" prop="signatureValuer1">
            <el-select v-model="reportCommonObj.signatureValuer1" style="width: 100%" clearable filterable>
              <el-option v-for="item in noPageReportUserList" :key="item.id" :value="item.id" :label="item.nickName" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="签字估价师2" prop="signatureValuer2">
            <el-select v-model="reportCommonObj.signatureValuer2" style="width: 100%" clearable filterable>
              <el-option v-for="item in noPageReportUserList" :key="item.id" :value="item.id" :label="item.nickName" />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex" :gutter="20" align="middle">
        <el-col :span="6">
          <el-form-item label="业务员" prop="salesman">
            <el-select v-model="reportCommonObj.salesman" style="width: 100%" clearable filterable @change="selectUser" @clear="resetUser">
              <el-option v-for="item in noPageReportUserList" :key="item.id" :value="item.id" :label="item.nickName" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="部门" prop="department">
            <el-select v-model="reportCommonObj.department" filterable clearable allow-create style="width: 100%">
              <el-option
                v-for="item in departments"
                :key="item.value1"
                :label="item.label1"
                :value="item.value1"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="组别" label-width="90px">
            <el-select v-model="reportCommonObj.tranches" filterable clearable allow-create style="width: 100%">
              <el-option
                v-for="item in tranchess"
                :key="item.value2"
                :label="item.label2"
                :value="item.value2"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="是否报备">
            <el-select v-model="reportCommonObj.putOnRecords" style="width: 100%">
              <el-option
                v-for="item in putOnRecords"
                :key="item.value3"
                :label="item.label3"
                :value="item.value3"
              />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form-item>
  </div>
</template>

<script>
import { noPageUser } from '@/api/user'
import { mapGetters } from 'vuex'
import { getSearchFormList } from '@/api/property-report'

export default {
  name: 'ReportInfo',
  props: {
    reportCommonObj: {
      reportName: '',
      type: Object,
      required: true
    },
    isAudit: {
      type: Boolean,
      default: false,
      required: true
    }
  },
  data() {
    return {
      noPageReportUserList: [],
      propertyType: [],
      propertyProjectType: [],
      assessmentPurpose: [],
      assessmentMethod: [],
      scopeAssessment2: [],
      evaluationObject: [],
      valueType: [],
      departments: [{
        value1: '数据信息部',
        label1: '数据信息部'
      }, {
        value1: '评估咨询部',
        label1: '评估咨询部'
      }, {
        value1: '总师室',
        label1: '总师室'
      }, {
        value1: '外地事业发展部',
        label1: '外地事业发展部'
      }, {
        value1: '行政部',
        label1: '行政部'
      }, {
        value1: '市场部',
        label1: '市场部'
      }, {
        value1: '资产评估事业部',
        label1: '资产评估事业部'
      }, {
        value1: '工程咨询部',
        label1: '工程咨询部'
      }, {
        value1: '总经理',
        label1: '总经理'
      }],
      value1: '',
      tranchess: [{
        value2: '数据业务组',
        label2: '数据业务组'
      }, {
        value2: '信息服务组',
        label2: '信息服务组'
      }, {
        value2: '评估组',
        label2: '评估组'
      }, {
        value2: '咨询组',
        label2: '咨询组'
      }, {
        value2: '市场一组',
        label2: '市场一组'
      }, {
        value2: '市场二组',
        label2: '市场二组'
      }],
      value2: '',
      putOnRecords: [{
        value3: '是',
        label3: '是'
      }, {
        value3: '否',
        label3: '否'
      }],
      value3: ''
    }
  },

  created() {
    this.init()
  },
  computed: {
    ...mapGetters([
      'id'
    ])
  },
  methods: {
    init() {
      this.getNoPageList()
    },

    getNoPageList() {
      this.getNoPageUserList()
      this.getSearchForm()
    },
    getNoPageUserList() {
      noPageUser().then(res => {
        this.noPageReportUserList = res.data.users
        this.noPageSignature = this.noPageReportUserList.filter(item => item.id === '1514497650193797121' || item.id === '1502197606761553921' || item.id === '1502197806955683841' || item.id === '1502197899352006658' || item.id === '1508298718535143425' || item.id === '1508299505017475074' || item.id === '1508299594242904066' || item.id === '1508298870004043778' || item.id === '1508298960420655105' || item.id === '1508299055350337537' || item.id === '1508300308801310722')
      })
    },
    getSearchForm() {
      getSearchFormList().then(res => {
        this.propertyType = res.data.propertyType
        this.propertyProjectType = res.data.propertyProjectType
        this.assessmentPurpose = res.data.assessmentPurpose
        this.assessmentMethod = res.data.assessmentMethod
        this.scopeAssessment2 = res.data.scopeAssessment2
        this.evaluationObject = res.data.evaluationObject
        this.valueType = res.data.valueType
      })
    },
    calculatePayHandler(val) {
      this.reportCommonObj.chargeGist = val
    },
    selectUser(val) {
      var user1 = this.noPageReportUserList.filter(item => item.id === val)
      this.reportCommonObj.department = user1[0].department
      this.reportCommonObj.tranches = user1[0].tranches
    },
    resetUser(val) {
      this.reportCommonObj.department = null
      this.reportCommonObj.tranches = null
    }
  }
}
</script>

<style scoped>

</style>
